package com.jx.smartbot.controller;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import com.jx.smartbot.VO.Result;
import com.jx.smartbot.VO.ToolsData;
import com.jx.smartbot.service.SystemSuperApp;
@RestController
public class BotTools {
	private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(BotTools.class);
	@Autowired
	SystemSuperApp systemSuperApp;
	@RequestMapping(value = "tlist", method = RequestMethod.POST)
	@ResponseStatus(HttpStatus.OK)
	public List<ToolsData> tlist(HttpServletRequest request) {
		List<ToolsData> datas=new ArrayList<>();
		ToolsData toolsData=new ToolsData();
		toolsData.setName("开会");
		toolsData.setUrl("https://111");
		toolsData.setTag("get");
		toolsData.setMsgid(23);
		datas.add(toolsData);
		return datas;
	}
	@CrossOrigin(origins = "http://172.20.56.5")
	@RequestMapping(value = "tools")
	@ResponseStatus(HttpStatus.OK)
	public Result<String> handles(
			@RequestParam(value="access_token", defaultValue="") String access_token,
			@RequestParam(value="token", defaultValue="") String token,
			@RequestParam(value="action", defaultValue="") String action,
			HttpServletRequest request) {
		logger.info("---------------{}----------------------",access_token);
		return new Result<String>(access_token);
	}
}
